package com.example.spring1.service.iml;

import com.example.spring1.dao.UserDao;
import com.example.spring1.entity.User;
import com.example.spring1.service.Loginservice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class Loginserviceiml implements Loginservice {
    @Autowired
    UserDao userDao;
    @Override
    public boolean login(String username, String password) {
        User user=userDao.getUserByusername(username);
        if(user==null){
            log.info("账号密码不存在");
            return false;
        }else if(user.getPassword().equals(password)){
            log.info("登陆成功");
            return true;
        }

            log.info("登陆失败");
            return false;
    }
}
